<!DOCTYPE html>
<html>
<head><title></title>
    <meta charset="utf-8">
    <script type="text/javascript" language="javascript" src="js/jquery-1.10.2.js"></script>
    <script type="text/javascript" language="javascript" src="js/jquery.form.js"></script>
    <script type="text/javascript"
            language="javascript"> $(function () {
    //异步提交表单 $("#ajaxSubmit").on("click",function(){ console.log($(this)); $("#formToUpdate").ajaxSubmit({ type:'post', url:'p.php', success:function(data){ console.log(data); }, error:function(XmlHttpRequest,textStatus,errorThrown){ console.log(XmlHttpRequest); console.log(textStatus); console.log(errorThrown); } }); }); }); </script>
</head>
<body>
<form id="formToUpdate" method="post" action="#" enctype="multipart/form-data"><input type="text" name="t1"><br/> <input
        type="file" name="f1"><br/> <input id="ajaxSubmit" type="button" value="异步提交"></form>
</body>
</html>